import http from './request.js'
const {request} = http
// 登录有效性检查
export const apiVlidationToken = (data) => {
	return request({
		url: '/mini/memberInfo/validationToken',
		data
	})
}
// 登录
export const apiLogin = (data) => {
	return request({
		url: '/registeredAndLogin',
		data,
		isToken: false,
		refreshToken: false,
	})
}
// 流量包订单分页
export const apiFlowOrderPage = (data) => {
	return request({
		url: '/mini/signPackageOrderInfo/page',
		data,
		headers: {
			"Content-Type": "application/x-www-form-urlencoded"
		},
		loading: false
	})
}
// 会员流量包剩余可用次数
export const apiTotalRemainingTimes = (data) => {
	return request({
		url: '/mini/memberSignPackage/totalRemainingTimes',
		data,
		headers: {
			"Content-Type": "application/x-www-form-urlencoded"
		},
		loading: false,
		// isToken:  false,
		refreshToken: false
	})
}
// 我的-流量包可用套餐
export const apiSignPackagePage = (data) => {
	return request({
		url: '/mini/signPackage/page',
		data,
		headers: {
			"Content-Type": "application/x-www-form-urlencoded"
		},
		refreshToken: false,

	})
}


// 获取即将过期的流量包:
export const apiExpiringSoonOne = (data) => {
	return request({
		url: '/mini/memberSignPackage/getExpiringSoonOne',
		data
	})
}
// 签署合同时使用流量包支付
export const apiMemberSignPackagePay = (data) => {
	return request({
		url: '/mini/memberSignPackage/pay',
		data
	})
}

// 小程序下单：
export const apiCreateOrder = (data) => {
	return request({
		url: '/mini/signPackageOrderInfo/createOrder',
		data
	})
}
// 创建合同
export const apiCreateContract = (data) => {
	return request({
		url: '/mini/contractInfo/add',
		data
	})
}
// 修改合同
export const apiUpdateContract = (data) => {
	return request({
		url: '/mini/contractInfo/update',
		data
	})
}
// 借条列表
export const apiContractPage = (data) => {
	return request({
		url: '/mini/contractInfo/page',
		data,
		headers: {
			"Content-Type": "application/x-www-form-urlencoded"
		},
		loading: false,
		refreshToken: false,
		goLogin: true
	})
}
// 借条详情
export const apiContractById = (data) => {
	return request({
		url: `/mini/contractInfo/view`,
		method: 'POST',
		data,
		headers: {
			"Content-Type": "application/x-www-form-urlencoded"
		}
	})
}
// 签署合同
export const apiSigning = (data) => {
	return request({
		url: '/mini/contractInfo/signing',
		data
	})
}

// 保存个人签名文件
export const apiMemberSignatureAdd = (data) => {
	return request({
		url: '/mini/memberSignature/add',
		data
	})
}
// 修改个人签名文件
export const apiMemberSignatureUpdate = (data) => {
	return request({
		url: '/mini/memberSignature/update',
		data
	})
}
// 地址库
export const apiDbArea = (data) => {
	return request({
		url: '/dbArea/tree',
		data,
		loading: false
	})
}
//合同绑定乙方
export const apiBind = (data) => {
	return request({
		url: '/mini/contractInfo/bind',
		data
	})
}

// 获取文档缓存
export const apiSetContractCache = (data) => {
	return request({
		url: '/mini/contractInfo/setContractCache',
		data
	})
}

// 预览
export const apiUpdateContractCache = (data) => {
	return request({
		url: '/mini/contractInfo/setContractCache',
		data
	})
}
// 获取文档缓存 
export const apiGetContractInfoCache = (data) => {
	return request({
		url: '/mini/contractInfo/getContractInfoCache',
		data,
		headers: {
			"Content-Type": "application/x-www-form-urlencoded"
		},
		loadMsg: '正在生成借条合同'
	})
}
// 预览 
export const apiPreview = (data) => {
	return request({
		url: '/mini/contractInfo/preview',
		data,
		loadMsg: '正在生成借条合同'
	})
}
// 重新发起
export const apiRelaunch = (data) => {
	return request({
		url: '/mini/contractInfo/relaunch',
		data,
		headers: {
			"Content-Type": "application/x-www-form-urlencoded"
		}
	})
}
// 拒签 
export const apiRefused = (data) => {
	return request({
		url: '/mini/contractInfo/refused',
		data
	})
}
// 撤回  
export const apiWithDrawn = (data) => {
	return request({
		url: '/mini/contractInfo/withDrawn',
		data
	})
}
// 删除
export const apiDelete = (data) => {
	return request({
		url: '/mini/contractInfo/delete',
		data
	})
}
// 人脸认证初始化
export const apiFaceCertify = (data) => {
	return request({
		url: '/mini/memberInfo/face/userCertifyOpen',
		data
	})
}
// 人脸认证结果查询
export const apiFaceQuery = (data) => {
	return request({
		url: '/mini/memberInfo/face/userCertifyOpenQuery',
		data
	})
}

// 变更转账状态信息支付凭证

export const apiPaymentVoucher = (data) => {
	return request({
		url: '/mini/contractInfo/paymentVoucher',
		data,
		headers: {
			"Content-Type": "application/x-www-form-urlencoded"
		}
	})
}
// 查询用户借款金额
export const apiGetMemberContractLoanAmount = (data) => {
	return request({
		url: '/mini/contractInfo/getMemberContractLoanAmount',
		data,
		headers: {
			"Content-Type": "application/x-www-form-urlencoded"
		},
		loading: false,
		// refreshToken:false
	})
}
// 文章查询
export const apiArticleById = (data) => {
	return request({
		url: '/mini/article/list',
		data,
		headers: {
			"Content-Type": "application/x-www-form-urlencoded"
		},
	})
}

// CA协议
export const apiGetCA = (data) => {
	return request({
		url: '/mini/contractInfo/gateGetAgreement',
		data,
		headers: {
			"Content-Type": "application/x-www-form-urlencoded"
		},
	})
}